home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: Augmented system matrix.
-
- // Syntax: augment ( A )
- // augment ( A , ALPHA )
-
- // Description:
-
- // augment(A) is the square matrix [EYE(m) A; A' ZEROS(n)] of
- // dimension m+n, where A is m-by-n. It is the symmetric and
- // indefinite coefficient matrix of the augmented system
- // associated with a least squares problem minimize NORM(A*x-b).
-
- // Special case: if A is a scalar, n say, then AUGMENT(A) is the
- // same as AUGMENT(RANDN(p,q)) where n = p+q and p = ROUND(n/2),
- // that is, a random augmented matrix of dimension n is produced.
-
- // If a second, scalar argument ALPHA is supplied, then the (1,1)
- // block of A is ALPHA*EYE(m). The eigenvalues of AUGMENT(A) are
- // given in terms of the singular values s(i) of A (where m>n) by
- // 1/2 +/- SQRT( s(i)^2 + 1/4 ), i=1:n (2n eigenvalues), 1,
- // (m-n eigenvalues).
-
- // If m < n then the first expression provides 2m eigenvalues and
- // the remaining n-m eigenvalues are zero.
-
- // See also SPAUGMENT.
-
- // Reference:
- // G.H. Golub and C.F. Van Loan, Matrix Computations, Second
- // Edition, Johns Hopkins University Press, Baltimore, Maryland,
- // 1989, sec. 5.6.4.
-
- // This file is a translation of augment.m from version 2.0 of
- // "The Test Matrix Toolbox for Matlab", described in Numerical
- // Analysis Report No. 237, December 1993, by N. J. Higham.
-
- //-------------------------------------------------------------------//
-
- augment = function ( A, alpha )
- {
- local (A, alpha)
-
- m = A.nr; n = A.nc;
-
- if (!exist (alpha)) { alpha = 1; }
-
- if (max(m,n) == 1)
- {
- n = A;
- p = round(n/2);
- q = n - p;
- rand("normal", 0, 1);
- A = rand(p,q);
- m = p;
- n = q;
- }
-
- C = [alpha*eye(m,m), A; A', zeros(n,n)];
- return C;
- };
-